<? session_start();
						
include_once ('core/conn.php');
						
$db = get_conn();
						
check_session();
						
if($_GET['id'] != ''){
							
	$sql = " select * from facility_type where id_ftype=".$_GET['id']; 
							
	$result = mysql_query($sql);	
							
	if($result){
								
		$row = mysql_fetch_array($result);
		$id_ftype = $row['id_ftype'];
		$name = $row['name'];
							
	}else{
								
		error_handling($sql,mysql_error());
							
	}
						
}
					
?>
<html>
<head>
<script>
					
<!--
						
	function checkdata(obj){
		if(obj.name.value ==''){
								
			alert('Please fill the name');
								
			obj.name.focus();
								
			return false;
							
		}
	return true;
						
	}
					
-->
					
</script>
</head>				
<body>			
<form name='facility_type' method='post' action='/core/facility_type.php' onsubmit='return checkdata(this)'>
  <table width='100%' border='0'>
    <tr>
      <td align='left'>ID</td>
      <td align='left'><input type='hidden' name='id_ftype' value='<? echo $id_ftype;?>'>
        <? echo $id_ftype;?></td>
    </tr>
    <tr>
      <td align='left'> Name </td>
      <td align='left'><input type='text' name='name' value='<? echo $name;?>'></td>
    </tr>
    <tr>
      <td colspan='2' align='center'><?
							  
					if ($_GET['id'] != ""){
								
						echo "<input type='submit' name='Actualizar' value='Update'>";
								
						echo "<input type='submit' name='Eliminar' value='Delete'>";										
								
						echo "<input type='submit' name='Nuevo' value='Cancel'>";
							  
					}else{
								
						echo "<input type='submit' name='Agregar' value='Add'>";
							  
					}
							 
					?></td>
    </tr>
  </table>
</form>
					
</body></html>					